import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/api/auth/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/api/auth/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/api/auth/logout',
    method: 'post'
  })
}

export function getUsers(params) {
  return request({
    url: '/api/system/users',
    method: 'get',
    params
  })
}

export function addUser(data) {
  return request({
    url: '/api/system/users',
    method: 'post',
    data
  })
}

export function updateUser(data) {
  return request({
    url: `/api/system/users/${data.id}`,
    method: 'put',
    data
  })
}

export function deleteUser(id) {
  return request({
    url: `/api/system/users/${id}`,
    method: 'delete'
  })
}

export function getRoles() {
  return request({
    url: '/api/system/roles',
    method: 'get'
  })
}    
